﻿#ifndef ADDTYPE_H
#define ADDTYPE_H
using namespace std;
#include <QString>
#include <map>
#include <QJsonParseError>
#include <QJsonDocument>
#include <QJsonObject>
#include <QJsonArray>
#include <QFile>
#include "Thread_pool.h"

#define BANK_FILE_PATH "D:/qt Projects/AlgXmlGenerate/Resources/Bankxml/bank.xml"

#define SPC_PATH "D:/qt Projects/AlgXmlGenerate/Resources/Specialxml/spc.xml"//jc
#define BANK_PATH "D:/qt Projects/AlgXmlGenerate/Resources/Bankxml/bank.xml"//jc

#define EVENT_JSON_PATH "D:/qt Projects/AlgXmlGenerate/Resources/Json/event.json"//jc
#define AGENT_JSON_PATH "D:/qt Projects/AlgXmlGenerate/Resources/Json/agent.json"//jc

static QString _name; //添加事务唯一的名称
static int k = 0;//记录多少条记录了
enum OperateType{
    None = 0x00,
    Add = 0x01,
    Mod = 0x02,
    Remove = 0x03
};
void openxmlFile(const char* XmlPath, QString &xmlcontent);//打开xml文件
void openxmlFile(QString &XmlPath, QString &newxmlcontent);//jc
void openxmlFile(QString &XmlPath, const QString &alpname, QString &newxmlcontent);//jc
void openJsonFile(QByteArray &jsonData,
                  QJsonParseError &error,
                  QJsonDocument &doc,
                  const char* JsonPath);//打开json文件
static map<QString, QStringList> Root_map;//存储 对应模版(_name ---> template)---> 添加的根节点名称
static map<int, QStringList> Res_Map; //存储所有排序结果
static map<QString, QString> TemPath_Map; //存储指定名称的模版路径
//添加的事务
enum addType{
    EVENT  = 0x01,
    Parm = 0x02,
    Agent = 0x03
};

static int Operatetype = OperateType::None;//操作类型
static int Eventtype = addType::EVENT;//事务类型
class AddEv{
public:
    AddEv(int eid):_eid(eid){

    }
    virtual ~AddEv(){

    }
    int getId(){
        return this->_eid;
    }
private:
    int _eid;
};

class EventAdd : public AddEv{
public:
    EventAdd():AddEv(addType::EVENT){
    }

    virtual ~EventAdd(){
    }
};

class ParmAdd : public AddEv{
public:
    ParmAdd():AddEv(addType::Parm){
    }
    virtual ~ParmAdd(){
    }
};

class AgentAdd : public AddEv{
public:
    AgentAdd():AddEv(addType::Agent){
    }
    virtual ~AgentAdd(){
    }
};

#endif // ADDTYPE_H
